// pages/recruit/personal/point/point.js
let getTodaySign = require('../../../../utils/signDate.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tasks:{
      point: 20,
      daily: [
        {
          name: "每日打卡",
          point: "每日打卡可得10积分",
          targeturl: "",
          isdone: "done",
        },
        {
          name: "报名并完成一份兼职",
          point: "完成后可得30积分",
          targeturl: "/pages/recruit/all/all",
          isdone: "",
        },
        {
          name: "查看三份兼职岗位",
          point: "可得10积分",
          targeturl: "/pages/recruit/all/all",
          isdone: "",
        },
        {
          name: "分享一份兼职",
          point: "成功分享一份兼职可得10积分",
          targeturl: "/pages/recruit/all/all",
          isdone: "",
        },
        {
          name: "分享一个任务",
          point: "任务每有一个人报名可得10积分",
          targeturl: "/pages/recruit/task/task",
          isdone: "",
        },
        {
          name: "分享小程序",
          point: "分享小程序可得10积分",
          targeturl: "",
          isdone: "",
        },
        {
          name: "发布兼职岗位",
          point: "完成可得10积分",
          targeturl: "/pages/release/index/index",
          isdone: "",
        },
        {
          name: "发布者完成线上结算",
          point: "每支出一元可获得1积分",
          targeturl: "",
          isdone: "",
        }
      ],
      newbie: [
        {
          name: "企业/个人完成认证",
          point: "通过审核可获得60积分",
          targeturl: "/pages/release/server/company/company",
          isdone: "",
        },{
          name: "发布首个兼职岗位",
          point: "通过审核可获得200积分",
          targeturl: "/pages/release/index/index",
          isdone: "",
        },
        {
          name: "发布者刷新兼职岗位",
          point: "完成可得10积分",
          targeturl: "/pages/release/server/refresh/refresh",
          isdone: "",
        },
        {
          name: "发布者置顶兼职岗位",
          point: "完成可得20积分",
          targeturl: "/pages/release/server/top/top",
          isdone: "",
        },{
          name: "查看报名信息",
          point: "完成可获得30积分",
          targeturl: "/pages/release/default/default?id=2",
          isdone: "",
        },{
          name: "首次发布三个兼职岗位",
          point: "完成可获得100积分",
          targeturl: "/pages/release/index/index",
          isdone: "",
        }, {
          name: "完成所有新手任务",
          point: "完成可获得300积分",
          targeturl: "",
          isdone: "",
        }
      ]
    },
    signdate: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const that = this;
    that.data.signdate = getTodaySign();
    // 获取用户的任务完成情况

    //获取签到日期的展示
    that.setData({
      signdate: that.data.signdate
    })
  },
  target: function(e) {//跳转页面，分为跳转tabar和普通页面两种状态
    var url = e.currentTarget.dataset.url;
    let istabar = url == "/pages/recruit/task/task" || url == "/pages/recruit/index/index" || url == "/pages/recruit/all/all";
    if (url.length != 0) {
      if (istabar){
        wx.switchTab({
          url: url,
        })
      }else{
        wx.navigateTo({
          url: url,
        })
      }
    }
  }
})